<div id=all_ms class=card style="display:<%=(@act == "new" ? "none":"on")%>">
<div class=page_head>
<h2><%="All milestones".t%></h2>
</div>
<%if @project.milestones.size == 0%>
 <div class=tour> 
 <%if (not @project.use_permission  or @project.use_permission.nil?) or (@project.use_permission and @cur_user.has_permission?("prj_" + @project.id.to_s + "_ms_new"))%>
   <h2><%=link_to "Post the first milestone for this project".t,"#",:onclick=>"Element.show('new_ms');Element.hide('all_ms')"%></h2>
  <%end%>
   <%="Keep track of what's due, when it's due, and who's responsible for doing it.".t%>
 </div>
 <%=feature'milestone'%>
<%end%>
<div style="margin-left:-15px">
<!--
<div id='gantt'>
<%#render :partial=>'gantt'%>
</div>
<div id="chart1divV3">
    <p>&nbsp;</p>
    <p>FusionCharts needs Adobe Flash Player to run. If you're unable to see the chart here, it means that your browser does not seem to have the Flash Player Installed. You can downloaded it <a href="http://www.adobe.com/products/flashplayer/" target="_blank"><u>here</u></a> for free.</p>
  </div>
  <script language="javascript" type="text/javascript">
     var chartV3 = new FusionCharts("/flash/Gantt.swf", "sampleChart1", "100%", "100%");
     chartV3.setDataXML("<%#@data%>");     
     chartV3.render("chart1divV3");
  </script>
-->
<%if (@project.use_permission and @cur_user.has_permission?("prj_" + @project.id.to_s + "_ms_view")) or (@project.use_permission.nil?) or (not @project.use_permission)%>

<div id=late_ms>
  <%=render :partial=>'late_milestones'%>
</div>

<div id=upcoming_ms>
   <%=render :partial=>'upcoming_milestones'%>
</div>

<div id=finished_ms>
<%if @project.finished_milestones.size > 0 %>
  <%=render :partial=>'finished_milestones'%>
<%end%>
</div>

<%end%>
</div>


</div> <!--card-->

<div id=new_ms class=card style="display:<%=(@act == "new" ? "on":"none")%>">
<script>
 Date.weekdays = $w("0 1 2 3 4 5 6");
 Date.months   = $w("Jan Feb Mar Apr May Jun Jul Agu Sep Oct Nov Dec");
</script>
<div class=page_head>
<span></span>
<h2><%='Add a milestone'.t%></h2>
</div>

<% form_for(:milestone, :url => project_milestones_path) do |f| %>
 <div class="float_right add_milestone">
    <%="Enter a title for this milestone".t%>:<span class=intro_txt>(<%="Ex: Design Review 2".t%>)</span><br />
    <%= f.text_field :name,:size=>20,:class=>'big'%><br/>
    <%="Who is response for?".t%><br />
    <select name=milestone[user_id] onchange="if(this.selectedIndex == 0 || this.selectedIndex ==2){Element.hide('mail_alert');$('milestone_mail_alert').checked = false}else{Element.show('mail_alert');$('milestone_mail_alert').checked = true}">
    <option><%="Anyone".t%></option>
    <option value=<%=@cur_user.id%>><%="Me".t%>(<%=@cur_user.name%>)</option>
    <option>---------</option>
    <%=options_from_collection_for_select @project.users - [@cur_user],"id","name"%>
    </select>
     <span style="display:none" id='mail_alert'>
     <%=f.check_box "mail_alert"%><%="Email now & 48-hours before it's due".t%> 
     </span>
    <%=f.hidden_field "project_id",:value=>params[:project_id]%>
    <br/>
     <span class="private_label"><%="Private".t%><%=f.check_box :private%></span>
    <br/>
    <hr size=1>
    <br/>
    <%=indicator('sub')%>
    <%= submit_tag "Create this milestone".t,:id=>'sub_ms',:onclick=>"Element.show('indicator_sub')" %>
    <%="or".t%> <%=link_to "Cancel".t,"#",:onclick=>"Element.hide('new_ms');Element.show('all_ms')",:class=>'admin'%>
 </div>
    <%="When's it due?".t%><br />
    <script type="text/javascript"> _translations = { "OK": "OK", "Now": "Now", "Today": "<%="Today".t%>" }; Date.weekdays = $w("0 1 2 3 4 5 6"); Date.months = $w("<%="Jan".t%> <%="Feb".t%> <%="Mar".t%> <%="Apr".t%> <%="May".t%> <%="Jun".t%> <%="Jul".t%> <%="Aug".t%> <%="Sep".t%> <%="Oct".t%> <%="Nov".t%> <%="Dec".t%>"); </script>

    <%=calendar_date_select_tag "milestone[due_at]",10.days.since(Time.now).strftime("%Y-%m-%d"),:embedded => true, :year_range =>3%>
<% end %>
</div>
